-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
job.sh: fix ERR trap #2218
job.sh: fix ERR trap #2218
Conversation
Turn on `set -e` so that if `cmd1` fails in a `cmd1; cmd2` syntax, the failure is trapped.
(It affected commands on separate lines too I think - I just used semicolons to save space in describing the problem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
false | true
now causes task failure.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, good.
For the record, on master this does not get trapped either (i.e. the single-line semi-colon construct isn't relevant - so I'll change the issue title slightly):
|
Actually, on master even an error in an environment var definition will not be trapped. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested as fixed - thanks.
A bit surprised by that. How did scripts that were expected to fail worked in the test battery? Do we by chance only have command failure at the end of functions? |
I guess so! I've just made a new test that confirms this (passes here, fails on master). I'll put up a PR. |
Jobs now die with EXIT instead of ERR.
Jobs now die with EXIT instead of ERR.
Turn on
set -e
so that ifcmd1
fails in acmd1; cmd2
syntax, thefailure is trapped.